package Thread;

public class Dom16 {//t线程等待mian线程结束
    public static void main(String[] args) throws InterruptedException {
        Thread MainThread =new Thread();
         Thread t=new Thread(()->{
             try {
                 System.out.println("开始等待Main线程结束");
                 MainThread.join();
                 System.out.println("等待Main线程结束");
             } catch (InterruptedException e) {
                 throw new RuntimeException();
             }
         });
         t.start();
         Thread.sleep(3000);
        System.out.println("main 线程结束");
    }
}
